﻿using MediatR;
using T_Person.BaseRep.Interface;
using T_Person.Domain;
using T_Person.Read.APi.Applaction.Command;

namespace T_Person.Read.APi.Applaction.CommandHandlers
{
    public class EmployeeSearchByidCommandHandler : IRequestHandler<EmployeeSearchByidCommand, Employee>
    {
        private readonly IEmployeeRep employeeRep;

        public EmployeeSearchByidCommandHandler(IEmployeeRep employeeRep)
        {
            this.employeeRep = employeeRep;
        }

        public async Task<Employee> Handle(EmployeeSearchByidCommand request, CancellationToken cancellationToken)
        {
            var list = await employeeRep.GetAloneByid(request.id);
            return list;
        }
    }
}
